<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<title>UCARPP: includes/graph.h Source File</title>

<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
  $(document).ready(initResizable);
</script>


</head>
<body>
<div id="top"><!-- do not remove this div! -->


<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  
  
  <td style="padding-left: 0.5em;">
   <div id="projectname">UCARPP
   &#160;<span id="projectnumber">1</span>
   </div>
   
  </td>
  
  
  
 </tr>
 </tbody>
</table>
</div>

<!-- Generated by Doxygen 1.7.6.1 -->
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="annotated.html"><span>Data&#160;Structures</span></a></li>
      <li class="current"><a href="files.html"><span>Files</span></a></li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="files.html"><span>File&#160;List</span></a></li>
      <li><a href="globals.html"><span>Globals</span></a></li>
    </ul>
  </div>
</div>
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
  initNavTree('graph_8h.html','');
</script>
<div id="doc-content">
<div class="header">
  <div class="headertitle">
<div class="title">includes/graph.h</div>  </div>
</div><!--header-->
<div class="contents">
<a href="graph_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/*</span>
<a name="l00002"></a>00002 <span class="comment"> * graph.h contiene le strutture necessarie al concetto di grafo.</span>
<a name="l00003"></a>00003 <span class="comment">        Inoltre, alla stregua di problem.h, contiene anche i metodi concernenti il grafo in sè.</span>
<a name="l00004"></a>00004 <span class="comment"> */</span>
<a name="l00005"></a>00005 
<a name="l00006"></a>00006 <span class="preprocessor">#ifndef GRAPH_H_</span>
<a name="l00007"></a>00007 <span class="preprocessor"></span><span class="preprocessor">#define GRAPH_H_</span>
<a name="l00008"></a>00008 <span class="preprocessor"></span>
<a name="l00009"></a>00009 <span class="preprocessor">#include &lt;stdbool.h&gt;</span>
<a name="l00010"></a>00010 <span class="preprocessor">#include &lt;stdio.h&gt;</span>
<a name="l00011"></a>00011 <span class="preprocessor">#include &lt;stdlib.h&gt;</span>
<a name="l00012"></a>00012 <span class="preprocessor">#include &quot;<a class="code" href="edgeID_8h.html">edgeID.h</a>&quot;</span>
<a name="l00013"></a>00013 <span class="preprocessor">#include &quot;<a class="code" href="edgeGraph_8h.html">edgeGraph.h</a>&quot;</span>
<a name="l00014"></a>00014 
<a name="l00018"></a><a class="code" href="graph_8h.html#a4f7d88186b9ead6ef5738717322647e8">00018</a> <span class="preprocessor">#define EVAL_PURE 0</span>
<a name="l00019"></a>00019 <span class="preprocessor"></span>
<a name="l00022"></a><a class="code" href="graph_8h.html#a34c30761ce06236f388cf2d662cbdf71">00022</a> <span class="preprocessor">#define EVAL_SMART 1</span>
<a name="l00023"></a>00023 <span class="preprocessor"></span>
<a name="l00026"></a><a class="code" href="graph_8h.html#a71948c8a8c71cff6cf6d5946f4d1ad97">00026</a> <span class="preprocessor">#define EVAL_WISE 2</span>
<a name="l00027"></a>00027 <span class="preprocessor"></span><span class="comment">//TODO documentazion</span>
<a name="l00028"></a><a class="code" href="graph_8h.html#a97a6c4b122c50a3e1e232160f0fe81ca">00028</a> <span class="preprocessor">#define EVAL_FAILED -1</span>
<a name="l00029"></a>00029 <span class="preprocessor"></span>
<a name="l00034"></a>00034 <span class="comment">//PAT non la sta usando e tutto funziona bene lo stesso. valutare di cancellare la macro</span>
<a name="l00035"></a><a class="code" href="graph_8h.html#a34856594900f5db4a14e4e03596303c6">00035</a> <span class="preprocessor">#define INFINITE_WEIGHT __FLT_MAX__*0.000001 //TODO WATCHTHIS pat ha cambiato FLT_MAX &gt; __FLT_MAX__ perchè non andava un cazzus</span>
<a name="l00036"></a>00036 <span class="preprocessor"></span>
<a name="l00037"></a>00037 
<a name="l00038"></a>00038 <span class="comment">// ******************* STRUCTS ******************</span>
<a name="l00039"></a>00039 
<a name="l00041"></a><a class="code" href="graph_8h.html#ad8909b856fa70c7731c787994276fb03">00041</a> <span class="keyword">typedef</span> <span class="keywordtype">float</span> <a class="code" href="graph_8h.html#ad8909b856fa70c7731c787994276fb03">Weight</a>;
<a name="l00043"></a><a class="code" href="graph_8h.html#a7e922f6340664fa997b787eb4933cef0">00043</a> <span class="keyword">typedef</span> <a class="code" href="graph_8h.html#ad8909b856fa70c7731c787994276fb03">Weight</a>* <a class="code" href="graph_8h.html#a7e922f6340664fa997b787eb4933cef0">Pweight</a>;
<a name="l00044"></a><a class="code" href="graph_8h.html#a3a4655e1bed6717e402b00fed86a0a50">00044</a> <span class="keyword">typedef</span> <a class="code" href="graph_8h.html#ad8909b856fa70c7731c787994276fb03">Weight</a>** <a class="code" href="graph_8h.html#a3a4655e1bed6717e402b00fed86a0a50">WeightMat</a>;
<a name="l00045"></a>00045 
<a name="l00047"></a><a class="code" href="structGraph.html">00047</a> <span class="keyword">typedef</span> <span class="keyword">struct </span><a class="code" href="structGraph.html">Graph</a> {
<a name="l00048"></a><a class="code" href="structGraph.html#ae7b263ea3d7be71244ea3ae5d6e46e07">00048</a>         <a class="code" href="structEdgeGraph.html">AdjMat</a> <a class="code" href="structGraph.html#ae7b263ea3d7be71244ea3ae5d6e46e07">am</a>;
<a name="l00051"></a><a class="code" href="structGraph.html#ae60454c8f1906fa493cf7220de736588">00051</a>         <span class="keywordtype">int</span>* <a class="code" href="structGraph.html#ae60454c8f1906fa493cf7220de736588">N</a>;
<a name="l00053"></a><a class="code" href="structGraph.html#a3ce250f958f7e96ffd9eb06780c21fbe">00053</a>         <span class="keywordtype">int</span> <a class="code" href="structGraph.html#a3ce250f958f7e96ffd9eb06780c21fbe">E</a>;
<a name="l00055"></a><a class="code" href="structGraph.html#ae1df2a6521b07507a0b245d20c8cb8e8">00055</a>         <span class="keywordtype">int</span> <a class="code" href="structGraph.html#ae1df2a6521b07507a0b245d20c8cb8e8">T</a>;
<a name="l00057"></a><a class="code" href="structGraph.html#aaa111d6e662844b61f165c3703185035">00057</a>         <span class="keywordtype">int</span> <a class="code" href="structGraph.html#aaa111d6e662844b61f165c3703185035">Q</a>;
<a name="l00061"></a><a class="code" href="structGraph.html#a0be22a6292126e01d863bab4163e3591">00061</a>         <a class="code" href="graph_8h.html#a3a4655e1bed6717e402b00fed86a0a50">WeightMat</a> <a class="code" href="structGraph.html#a0be22a6292126e01d863bab4163e3591">timeWM</a>;
<a name="l00065"></a><a class="code" href="structGraph.html#a0d724d67f5696e3703191b61746f6b51">00065</a>         <a class="code" href="graph_8h.html#a3a4655e1bed6717e402b00fed86a0a50">WeightMat</a> <a class="code" href="structGraph.html#a0d724d67f5696e3703191b61746f6b51">loadWM</a>;
<a name="l00067"></a><a class="code" href="structGraph.html#afaad43dab3d4e3adb57a1e74864966e5">00067</a>         <span class="keywordtype">int</span> <a class="code" href="structGraph.html#afaad43dab3d4e3adb57a1e74864966e5">depot</a>;
<a name="l00068"></a>00068 } <a class="code" href="graph_8h.html#a5d294fbd6d03f6059ecd3a9e5668041c">Graph</a>;
<a name="l00069"></a><a class="code" href="graph_8h.html#a804cfb50d20c745519ebc5a645437049">00069</a> <span class="keyword">typedef</span> <a class="code" href="structGraph.html">Graph</a>* <a class="code" href="graph_8h.html#a804cfb50d20c745519ebc5a645437049">Pgraph</a>;
<a name="l00070"></a>00070 
<a name="l00071"></a>00071 <span class="comment">// ******************** COSTRUTTORI ***************************</span>
<a name="l00072"></a>00072 
<a name="l00073"></a>00073 
<a name="l00082"></a>00082 <a class="code" href="structGraph.html">Pgraph</a> <a class="code" href="graph_8h.html#ae45fa86bc327274fa9c22ce29db31f11">initGraph</a>(<span class="keywordtype">int</span>* N, <span class="keywordtype">float</span> T, <span class="keywordtype">float</span> Q,<span class="keywordtype">int</span> depot);
<a name="l00083"></a>00083 
<a name="l00103"></a>00103 <a class="code" href="structGraph.html">Pgraph</a> <a class="code" href="graph_8h.html#aa0ce2043674597087c336bfa0dc315e5">initCompleteGraph</a>(<span class="keywordtype">int</span>* N, <span class="keywordtype">float</span> T, <span class="keywordtype">float</span> Q,<span class="keywordtype">int</span> depot, <a class="code" href="structEdgeGraph.html">EdgeGraph</a> edge);
<a name="l00104"></a>00104 
<a name="l00115"></a>00115 <span class="keywordtype">void</span> <a class="code" href="graph_8h.html#a95d25cb8c150c7b95fbefd505bee28c1">initSmartWeights</a>(<a class="code" href="structGraph.html">Pgraph</a> pg);
<a name="l00116"></a>00116 
<a name="l00117"></a>00117 <span class="comment">// ************************* FUNZIONI *******************************</span>
<a name="l00118"></a>00118 
<a name="l00129"></a>00129 <span class="keywordtype">void</span> <a class="code" href="graph_8h.html#a1531bf943233033ea8f57b5aa296a0dc">printGraph</a>(FILE* f, <a class="code" href="structGraph.html">Pgraph</a> pg);
<a name="l00130"></a>00130 
<a name="l00150"></a>00150 <span class="keywordtype">void</span> <a class="code" href="graph_8h.html#acbf94fe8adce7472a0db9788a9d9bb11">printAdjMatrix</a>(FILE* f, <a class="code" href="structGraph.html">Pgraph</a> pg, <span class="keywordtype">char</span> type);
<a name="l00151"></a>00151 
<a name="l00152"></a>00152 <span class="comment">//FORPAT aggiornare la documentazione</span>
<a name="l00153"></a>00153 <span class="comment">/* stampa a stdout della matrice di adiacenza completa</span>
<a name="l00154"></a>00154 <span class="comment"> * * Il flag full stampa triangolare o completa.</span>
<a name="l00155"></a>00155 <span class="comment"> * il format del printato è sempre 3 cifre, 0 delle cui a dx della virgola. */</span>
<a name="l00156"></a>00156 <span class="keywordtype">void</span> <a class="code" href="graph_8h.html#af6c419673cb65813148d42087663bff9">printWholeMatrix</a>(FILE* f, <a class="code" href="structGraph.html">Pgraph</a> pg);
<a name="l00157"></a>00157 
<a name="l00174"></a>00174 <span class="keywordtype">void</span> <a class="code" href="graph_8h.html#a26576f17daf1b37754e0bfcac406a647">printEdgeFromGraph</a>(FILE* f, <a class="code" href="structGraph.html">Pgraph</a> pg, <a class="code" href="structEdgeID.html">PedgeID</a> edge);
<a name="l00175"></a>00175 
<a name="l00198"></a>00198 <a class="code" href="structEdgeGraph.html">PedgeGraph</a> <a class="code" href="graph_8h.html#a2074728058492cdd0094f7fc58eeea74">getEdgeGraph</a>(<a class="code" href="structGraph.html">Pgraph</a> pg, <a class="code" href="structEdgeID.html">PedgeID</a> edge);
<a name="l00199"></a>00199 
<a name="l00220"></a>00220 <a class="code" href="graph_8h.html#ad8909b856fa70c7731c787994276fb03">Weight</a> <a class="code" href="graph_8h.html#a22b642cd69197fca2b9fe65b480762e1">getEdgeTimeWeight</a>(<a class="code" href="structGraph.html">Pgraph</a> pg,<a class="code" href="structEdgeID.html">PedgeID</a> edge);
<a name="l00221"></a>00221 
<a name="l00242"></a>00242 <a class="code" href="graph_8h.html#ad8909b856fa70c7731c787994276fb03">Weight</a> <a class="code" href="graph_8h.html#a61aeaf35eb1f649a7bc296224eee3ebc">getEdgeLoadWeight</a>(<a class="code" href="structGraph.html">Pgraph</a> pg, <a class="code" href="structEdgeID.html">PedgeID</a> edge);
<a name="l00243"></a>00243 
<a name="l00244"></a>00244 <span class="comment">/*</span>
<a name="l00245"></a>00245 <span class="comment"> * metodo per modularizzazione low-level del codice. Dato un arco (i,j) ne estrae</span>
<a name="l00246"></a>00246 <span class="comment"> * il dato del type desiderato tra (t,d,p).</span>
<a name="l00247"></a>00247 <span class="comment"> */</span>
<a name="l00248"></a>00248 <span class="keywordtype">int</span> <a class="code" href="graph_8h.html#a0dbe24207cb04946ebfb3c1f28d7c8de">getEdgeGraphValue</a>(<a class="code" href="structGraph.html">Pgraph</a> pg, <span class="keywordtype">int</span> i, <span class="keywordtype">int</span> j, <span class="keywordtype">char</span> type);
<a name="l00249"></a>00249 
<a name="l00253"></a>00253 <span class="keywordtype">bool</span> <a class="code" href="graph_8h.html#af78262f5ef9cf37f127c81f0c51eb24b">isEdgeProfitable</a>(<a class="code" href="structGraph.html">Pgraph</a> pg, <a class="code" href="structEdgeID.html">PedgeID</a> pid);
<a name="l00254"></a>00254 
<a name="l00276"></a>00276 <a class="code" href="graph_8h.html#ad8909b856fa70c7731c787994276fb03">Weight</a> <a class="code" href="graph_8h.html#a23622d71867b1817151285cb760b8205">evaluateEdge</a>(<a class="code" href="structGraph.html">Pgraph</a> pg, <a class="code" href="structEdgeID.html">PedgeID</a> pedge, <span class="keywordtype">int</span> tau, <span class="keywordtype">int</span> theta, <span class="keywordtype">short</span> mode);
<a name="l00277"></a>00277 
<a name="l00284"></a>00284 <a class="code" href="graph_8h.html#ad8909b856fa70c7731c787994276fb03">Weight</a> <a class="code" href="graph_8h.html#a15897981c39a45987da1d9038c877cde">evaluateNonProfitableEdge</a>(<a class="code" href="structGraph.html">Pgraph</a> pg, <a class="code" href="structEdgeID.html">PedgeID</a> pedge, <span class="keywordtype">int</span> tau, <span class="keywordtype">short</span> mode);
<a name="l00285"></a>00285 
<a name="l00286"></a>00286 
<a name="l00301"></a>00301 <span class="keywordtype">void</span> <a class="code" href="graph_8h.html#a0498e7c9027e7617c269d6d7c7f2ad69">setEdgeGraph</a>(<a class="code" href="structGraph.html">Pgraph</a> pg,<a class="code" href="structEdgeID.html">PedgeID</a> <span class="keywordtype">id</span>, <span class="keywordtype">int</span> t,<span class="keywordtype">int</span> d,<span class="keywordtype">int</span> p);
<a name="l00302"></a>00302 
<a name="l00317"></a>00317 <span class="keywordtype">void</span> <a class="code" href="graph_8h.html#a059b2bddd5e1e7daf98434674a3779dc">setEdgeGraphTime</a>(<a class="code" href="structGraph.html">Pgraph</a> pg,<a class="code" href="structEdgeID.html">PedgeID</a> <span class="keywordtype">id</span>,<span class="keywordtype">int</span> t);
<a name="l00318"></a>00318 
<a name="l00332"></a>00332 <span class="keywordtype">void</span> <a class="code" href="graph_8h.html#a6063777b21e84f848e517916279ce549">setEdgeGraphByIndexes</a>(<a class="code" href="structGraph.html">Pgraph</a> pg, <span class="keywordtype">int</span> i, <span class="keywordtype">int</span> j, <span class="keywordtype">int</span> t, <span class="keywordtype">int</span> d, <span class="keywordtype">int</span> p);
<a name="l00333"></a>00333 
<a name="l00334"></a>00334 <span class="comment">// Itera l&#39;algoritmo di Dijkstra su ogni nodo, per riempire la tabella</span>
<a name="l00335"></a>00335 <span class="keywordtype">void</span> <a class="code" href="graph_8h.html#a4c2445aec7362664da1023b4abea4956">dijkstraFiller</a>(<a class="code" href="structGraph.html">Pgraph</a> pg);
<a name="l00336"></a>00336 
<a name="l00354"></a>00354 <span class="keywordtype">void</span> <a class="code" href="graph_8h.html#a53a42ae459a6b3ff232dc3386a3679db">graphCorrector</a>(<a class="code" href="structGraph.html">Pgraph</a> pg);
<a name="l00355"></a>00355 
<a name="l00357"></a>00357 <span class="keywordtype">void</span> <a class="code" href="graph_8h.html#af4970b0149fbe0e6df67be1354a17c1f">printRemainingResources</a>(FILE* f, <a class="code" href="structGraph.html">Pgraph</a> pg, <span class="keywordtype">int</span> tau, <span class="keywordtype">int</span> theta);
<a name="l00358"></a>00358 
<a name="l00359"></a>00359 <span class="preprocessor">#endif </span><span class="comment">/* GRAPH_H_ */</span>
</pre></div></div><!-- contents -->
</div>
  <div id="nav-path" class="navpath">
    <ul>
      <li class="navelem"><a class="el" href="graph_8h.html">graph.h</a>      </li>

    <li class="footer">Generated on Wed Sep 4 2013 06:38:56 for UCARPP by
    <a href="http://www.doxygen.org/index.html">
    <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.6.1 </li>
   </ul>
 </div>


</body>
</html>
